<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@include file="/includes.jsp"%>

<h1 class="layout">
    <logic:empty name="personValue" property="personId">
        Create
    </logic:empty>
    <logic:notEmpty name="personValue" property="personId">
        Edit
    </logic:notEmpty>
    Person
</h1>

<html:errors/>

<html:form action="person.do?method=edit" method="post">
    <table class="layout" style="background-image: url(<html:rewrite page='/icons/person-32x32.png'/>);">
        <tr>
            <th class="layout">First Name:</th>
            <td class="layout"><html:text name="personActionForm" property="firstName" size="80"/></td>
        </tr>
        <tr>
            <th class="layout">Last Name:</th>
            <td class="layout"><html:text name="personActionForm" property="lastName" size="80"/></td>
        </tr>
        <tr>
            <th class="layout">Job Title:</th>
            <td class="layout"><html:text name="personActionForm" property="jobTitle" size="80"/></td>
        </tr>
        <tr>
            <th class="layout">Description:</th>
            <td class="layout"><html:textarea name="personActionForm" property="description" cols="60" rows="10"/></td>
        </tr>
        <tr>
            <th class="layout">Contact Details:</th>
            <td class="layout">
                <table class="styled" cellspacing="0">
                    <tr>
                        <th class="styled" width="100%">Name</th>
                        <th class="styled">Value</th>
                    </tr>
                    <logic:iterate name="personActionForm" property="contactDetails" id="key">
                        <logic:notEmpty name="personActionForm" property='<%= "contactDetailId(" + key + ")" %>'>
                            <html:hidden name="personActionForm" property='<%= "contactDetailId(" + key + ")" %>'/>
                        </logic:notEmpty>
                        <tr>
                            <td class="styled"><beans:write name="personActionForm" property='<%= "contactDetailTypeName(" + key + ")" %>'/></td>
                            <td class="styled">
                                <html:text name="personActionForm" property='<%= "contactDetailValue(" + key + ")" %>' size="60"/>
                            </td>
                        </tr>
                    </logic:iterate>
                </table>
            </td>
        </tr>
    </table>
    <div class="buttons">
        <html:submit property="btnSubmit" value="OK"/>
        <html:cancel property="btnSubmit" value="Cancel"/>
    </div>
</html:form>
